//
//  SearchCarRootView.m
//  CarHome
//
//  Created by lanou3g on 15-4-27.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "SearchCarRootView.h"

@implementation SearchCarRootView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addAllViews];
    }
    return self;
}

- (void)addAllViews {
    CGRect rect = [UIScreen mainScreen].bounds;
    self.brandListTV = [[[UITableView alloc] initWithFrame:rect] autorelease];
    [self addSubview:_brandListTV];
    
    
    self.carView = [[UIView alloc] initWithFrame:CGRectMake(kWIDTH, kMARGIN_TOP , kWIDTH - kMARGIN_LEFT, kHEIGHT - kMARGIN_TOP - 49)];
    [self addSubview:_carView];
    _carView.backgroundColor = [UIColor whiteColor];
    self.carListTV = [[UITableView alloc] initWithFrame:CGRectMake(0, 50, _carView.frame.size.width, _carView.frame.size.height - 50)];
    [_carView addSubview:_carListTV];
    
    self.segmentedControl = [[[UISegmentedControl alloc] initWithItems:@[@"在售", @"全部"]] autorelease];
    _segmentedControl.frame = CGRectMake(20, 10, kWIDTH - 40 - kMARGIN_LEFT, 30);
    _segmentedControl.tintColor = [UIColor blueColor];
    [_carView addSubview:_segmentedControl];
    
    self.sideBarView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 5, kHEIGHT)];
    _sideBarView.image = [UIImage imageNamed:@"sideBar_shadow_bg"];
    [_carView addSubview:_sideBarView];
    
}



- (void)dealloc
{
    [_brandListTV release];
    [_carListTV release];
    
    [super dealloc];
}
@end
